package com.qire.manhua.activity;

import android.os.Bundle;
import android.view.View;

import com.qire.antscore.annotation.RouteMapping;
import com.qire.antsrouter.AntsRouter;
import com.qire.antsrouter.inject.Autowired;
import com.qire.common.basic.ObjectUtil;
import com.qire.common.constant.Navigation;
import com.qire.common.support.base.BaseActivity;
import com.qire.common.utils.ThemeUtil;
import com.qire.manhua.R;
import com.qire.manhua.databinding.ActivityVipInstructionsBinding;
import com.qire.manhua.model.enumeration.VipPrivilegeType;
import com.qire.manhua.view.adapter.pager.VipInstructionsAdapter;

import androidx.annotation.Nullable;

@RouteMapping(path = Navigation.Page.VipInstructionsPage)
public class VipInstructionsActivity extends BaseActivity<ActivityVipInstructionsBinding> {

    @Autowired
    VipPrivilegeType type;

    @Override
    public int layoutRid() {
        return R.layout.activity_vip_instructions;
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ThemeUtil.transparencyBar(this);

        ActivityVipInstructionsBinding viewDataBinder = viewDataBinder();
        viewDataBinder.vipInstructionsViewPager.setAdapter(new VipInstructionsAdapter().initView(this));
        viewDataBinder.vipInstructionsTabLayout.setViewPager(viewDataBinder.vipInstructionsViewPager);

        if(ObjectUtil.nonNull(type)) {
            viewDataBinder.getRoot().post(() -> viewDataBinder.vipInstructionsViewPager.setCurrentItem(type.pageNo));
        }
    }

    public void backBtnOnClick(View view) {
        onBackPressed();
    }

    public void buyMembershipBtnOnClick(View view) {
        AntsRouter.ROUTER.buildCard(Navigation.Page.BuyMembershipPage).navigation();
        finish();
    }

}
